export class JsonResult{
    code:number;
    status:string;
    msg:string;
    data:any;

    static ok():JsonResult{
        let ret = new JsonResult();
        ret.code = 1;
        ret.msg = '成功';
        ret.data = null;
        return ret;
    }

    static getError(msg:string = '验证未通过，操作被中断！'):JsonResult{
        let ret = new JsonResult();
        ret.code = -1;
        ret.msg = msg;
        ret.data = null;
    
        return ret;
    }

    static setData<T>(data:T):JsonResult{
        let ret:JsonResult = new JsonResult();
        ret.data = data;
        ret.code = 1;
        ret.msg = '成功';
        return ret;
    }
}

